// 登录模块,mock数据模拟

// 用户登录模拟数据
const userMap = {
    admin: {
        meta: {
            code: 200,
            message: ''
        },
        data: {
            token: '5950a2419adc231f356a6636'
        }
      }
}

// 角色列表模拟数据
const roleMap = {
    admin: {
        meta: {
            code: 200,
            message: ''
        },
        data: {
            avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
            name: 'admin',
            role: ['admin']
        }
    }
}

// 用户登出模拟数据
const loginOutMap = {
    admin: {
        meta: {
            code: 200,
            message: ''
        },
        data: {
            loginout: 'chenggong'
        }
    }
}

// 检查登陆账号是否存在
const checkLogin = {
    name: {
        meta: {
            code: 200,
            message: ''
        },
        data: {}
    },
    password: {
        meta: {
            code: 200,
            message: ''
        },
        data: {}
    }

}

export default {
    login: config => {
      const { email } = JSON.parse(config.body);
      return userMap['admin'];
    },
    getInfo: config => {
        return roleMap['admin'];
    },
    logout: () => {
        return loginOutMap['admin']
    },
    checkLoginName : () => {
        return checkLogin['name'];
    },
    checkLoginPass : () => {
        return checkLogin['password'];
    }
  };
